package com.lzy.controller;

import com.lzy.common.CommonResult;
import com.lzy.entity.Message;
import com.lzy.service.PublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuzhongyu
 * @date: 2021/10/17 16:04
 * @desc: 消息发布者controller
 */
@RestController
public class PublisherController {

    @Autowired
    private PublisherService publisherService;

    /**
     * 发布消息到redis指定频道
     * @param message
     * @return
     */
    @PostMapping("/pubMsg")
    public CommonResult pubMsg(@RequestBody Message message){
        CommonResult commonResult = publisherService.pubMsg(message);
        return commonResult;
    }


}
